<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>组件</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
    <div id="example-2">
        <simple-counter></simple-counter>
        <simple-counter></simple-counter>
        <simple-counter></simple-counter>
    </div>


    <script>
        var data={counter:0};
        Vue.component('simple-counter',{
            template:'<button v-on:click="counter += 1">{{counter}}</button>',
            data:function () {
                return{
                    counter:0
                }
            }
        });
        new Vue({
            el:'#example-2'
        })
    </script>
</body>
</html>